<template>
    <div class="index-container">
        <!-- 导航栏 -->
        <indexNavBar
            :title="driverInfo.truckerName"
            @click-left="$router.go(-1)"
        ></indexNavBar>

        <!-- 基本信息 -->
        <p class="index-team-subtit">基本信息</p>
        <div class="index-team-info">
            <div class="index-team-list">
                <span>姓名</span>
                <span>{{driverInfo.truckerName || '-'}}</span>
            </div>
            <div class="index-team-list">
                <span>电话</span>
                <span>{{driverInfo.truckerTel || '-'}}</span>
            </div>
            <div class="index-team-list">
                <span>驾驶证级别</span>
                <span>{{driverInfo.driveLevelTypeName || '-'}}</span>
            </div>
            <div class="index-team-list">
                <span>驾驶证号</span>
                <span>{{driverInfo.driveLevelType || '-'}}</span>
            </div>
        </div>

        <!-- 动态信息 -->
        <p class="index-team-subtit">动态信息</p>
        <div class="index-team-info" style="margin-bottom: 60px;">
            <div class="index-team-list">
                <span>当前驾驶车辆</span>
                <span>{{driverInfo.driverAuto || '-'}}</span>
            </div>
            <div class="index-team-list">
                <span>今日里程(KM)</span>
                <span>{{driverInfo.dailyMile || 0 }}</span>
            </div>
        </div>
    </div>
</template>

<script>
import indexNavBar from '../../components/style/index-nav-bar.vue'

export default {
    components: {
        indexNavBar
    },
    data () {
        return {
            truckerId: '',
            driverInfo: []
        }
    },
    mounted () {
        this.init()
        this.hideItem()
    },
    methods: {
        /* 初始化 */
        init () {
            this.truckerId = this.$route.query.truckerId
            this.getDriverInfo()
        },

        /* 获取司机详情*/
        async getDriverInfo () {
            let _ = this
            try {
                _.$U.showLoading(_)
                let url = _.$A.team.trucker + '/' + this.truckerId
                const { data: res } = await _.$H.get(_, url, {})
                _.driverInfo = res
                _.$U.hideLoading(_)
            } catch (e) {
                _.$U.hideLoading(_)
            }
        }
    }
}
</script>

<style lang="less" scoped>

</style>
